package com.example.demo.Controller;

import com.example.demo.Entity.Person;
import com.example.demo.Service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/redis")
public class RedisController {
    @Autowired
    private RedisService redisService;

    @PutMapping("/person")
    public String putPerson(Person person){
        System.out.println("Person:"+person);
        redisService.put(person);
        return "success put!!!";
    }

    @GetMapping("/person/{name}")
    public Person getPerson(@PathVariable("name") String name){
        return redisService.get(name);
    }

}
